<template>
	<div style="margin-top: 20px;">
		<div>
			<el-table :data="tableData" style="width: 100%" stripe highlight-current-row>
				<el-table-column label="固定icon" width="370" prop="icon" align="center"></el-table-column>
				<el-table-column label="动态标题" width="370" prop="title" align="center"></el-table-column>
				<el-table-column label="发布时间" width="370" prop="createTime" align="center"></el-table-column>
				<el-table-column label="操作" align="center">
					<template slot-scope="scope">
						<el-button size="mini" @click="cxxs(scope.row)" type="primary">查看详情</el-button>
					</template>
				</el-table-column>
			</el-table>
			<el-dialog :visible.sync="dialogFormVisible" title="查看详情" :append-to-body="true">
				<el-form :model="form">
					<el-form-item label="固定icon" :label-width="formLabelWidth">
						<el-input v-model="form.icon" autocomplete="off"></el-input>
					</el-form-item>
					<el-form-item label="动态标题" :label-width="formLabelWidth">
						<el-input v-model="form.title" autocomplete="off"></el-input>
					</el-form-item>
					<el-form-item label="发布时间" :label-width="formLabelWidth">
						<!-- type="date" 表示日期
						 disabled 固定没办法修改-->
						<el-date-picker v-model="form.createTime" placeholder="请选择发布时间" type="date" disabled></el-date-picker>
					</el-form-item>
				</el-form>
			</el-dialog>
		</div>
		<div class="fotter">
			<el-button type="infor" @click='back'>公告显示</el-button>
		</div>
	</div>

</template>

<script>
	import {ptdtlist} from '@/api/rw.js'
	export default {
		data() {
			return {
				xgone: {},
				dialogFormVisible: false,
				tableData: [],
				form: {},
				formLabelWidth: '120px'
			}
		},
		methods: {
			back(){
				console.log(111)
				this.$router.push('/system/test')
			},
			// 查看详情
			cxxs(i){
				console.log(i);
				this.form = i
				this.dialogFormVisible = true
			}
		},
		async mounted(){
			// 写接口
			let r = await ptdtlist()
			console.log(r);
			this.tableData = r.data
		}
	}
</script>

<style>
	/* 固定按钮 */
	.fotter {
		position: fixed;
		bottom: 30px;
		right: 20px;
	}
</style>
